package com.heyu.cgsd.util;

public class LengthConvertUtils {
    private static final int M = 0;
    private static final int KM = 1;
    private static final int DM = 2;
    private static final int CM = 3;
    private static final int MM = 4;
    private static final int UM = 5;
    private static final int NM = 6;
    private static final int PM = 7;
    private static final int NMI = 8;
    private static final int MI = 9;
    private static final int FUR = 10;
    private static final int FM = 11;
    private static final int YD = 12;
    private static final int FT = 13;
    private static final int IN = 14;
    private static final int GONGLI = 15;
    private static final int LI = 16;
    private static final int ZHANG = 17;
    private static final int CHI = 18;
    private static final int CUN = 19;
    private static final int FEN = 20;
    private static final int LII = 21;
    private static final int LD = 22;
    private static final int LY = 23;

    private static double[] c = {1, 1000, 0.1, 0.01, 0.001, 0.000001, 0.000000001, 0.000000000001,
            1852, 1609.344, 201.168, 1.8288, 0.9144, 0.3048, 0.0254, 1000, 500,
            3.33333333, 0.333333333, 0.033333333, 0.003333333, 0.000333333, 384401000, 9460730470000000d};

    public static double convert(double input, int srcUnit, int desUnit) {
        double result = input * c[srcUnit];

        return result / c[desUnit];
    }

    public static void main(String[] args) {
        double d = LengthConvertUtils.convert(1, CM, KM);
    }
}
